Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Update slot components to use overridesResolver part 1 #25853

Merged
merged 4 commits into from
Apr 21, 2021

Conversation

mnajdova
Copy link
Member

@mnajdova mnajdova commented Apr 20, 2021

This PR updates the components starting with A to use overridesResolver per slot component. (need to somehow batch the changes in few PRs, otherwise the PR would be too big).

I am disabling the testDeepOverrides as we no longer support it. In some cases we still need to define the overrides on the root, for example in the AvatarGroup, when we are just applying the classes on a component down the tree, which is not created by a styled() utility.


I've done some preliminary benchmark in #25850 and seems like perf are great with this approach.

const { styleProps } = props;

return {
[`& .${accordionClasses.region}`]: styles.region,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no component for this one.

@mui-pr-bot
Copy link

mui-pr-bot commented Apr 20, 2021

Details of bundle changes

Generated by 🚫 dangerJS against 9b94358

const overridesResolver = (props, styles) => {
return deepmerge(
{
[`& .${avatarGroupClasses.avatar}`]: styles.avatar,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good example where this approach may not work everywhere. In this case we need to still keep this, otherwise it won't work.

Comment on lines +71 to +79
[`& .${autocompleteClasses.tag}`]: {
...styles.tag,
...styles[`tagSize${capitalize(size)}`],
},
[`& .${autocompleteClasses.inputRoot}`]: styles.inputRoot,
[`& .${autocompleteClasses.input}`]: {
...styles.input,
...(inputFocused && styles.inputFocused),
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no slot components for these overrides keys, so we need to keep them

@mnajdova mnajdova marked this pull request as ready for review April 20, 2021 15:51
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@mnajdova
Copy link
Member Author

Looks good

👍 ok let's continue with the rest of the components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants